<style lang="scss" scoped>
.box {
    width: 100vw;
    height: 100vh;
    background-color: rgb(245, 245, 245);
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    flex-direction: column;
    height: 250px;
    background-color: #fff;
    border-radius: 10px;
    padding: 10px;
    margin: 10px;

    .top {
        display: flex;
        flex-direction: column;
        height: 100px;
        width: 90vw;
        text-align: center;
        border-bottom: 1px solid #ececec;
        align-items: center;

        p {
            font-size: 14px;
            padding: 10px 0 0 0;
        }

        span {
            color: rgb(30, 111, 255);
            padding: 10px 0;
            font-weight: 600;
            font-size: 25px;
        }
    }

    ul {
        display: flex;
        flex-direction: column;
        margin-top: 20px;
        padding: 0 10px;

        li {
            display: flex;
            align-items: center;
            height: 30px;
            font-size: 14px;

            span {
                margin-left: 10px;
            }
        }
    }
}

.divp {
    line-height: 50px;
    font-size: 16px;
    padding: 0 10px;
}

.WvZf {
    height: 50px;
    display: flex;
    justify-content: space-between;
    background-color: #fff;
    border-radius: 10px;
    margin: 0 10px;
    align-items: center;

    img {
        width: 30px;
        height: 30px;
        margin: 0 10px;
    }

    p {
        height: 50px;
        display: flex;
        align-items: center;

        span {
            font-size: 14px;
        }
    }
}

.footer {
    position: fixed;
    bottom: 0;
    width: 100vw;
    height: 50px;
    background-color: #fff;
    display: flex;
    align-items: center;

    button {
        width: 100vw;
        margin: 0 10px;
        height: 40px;
        border-radius: 20px;
        border: none;
        color: #fff;
        font-size: 16px;
        background-color: rgb(30, 111, 255);
    }
}

.app {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;

    .p {
        padding: 20px;
        background-color: #fff;
        text-align: center;
        align-items: center;
        font-size: 20px;
    }
}
</style>
<template>
    <div class="box">
        <van-nav-bar title="收银台" left-arrow @click-left="$router.go(-1)" />
        <div class="header">
            <div class="top">
                <p>请支付金额</p>
                <span>￥15.00</span>
            </div>
            <ul>
                <li>
                    <p>服务类型:</p>
                    <span>图文问诊</span>
                </li>
                <li>
                    <p>服务医生:</p>
                    <span>医生名</span>
                    <span>妇科</span>
                    <span>主治医生</span>
                </li>
                <li>
                    <p>服务价格:</p>
                    <span>￥15.00/次</span>
                </li>
            </ul>
        </div>
        <div class="divp">
            <p>请选择支付方式</p>
        </div>
        <div class="WvZf">
            <p>
                <img src="../../../../../assets/img/微信.png" alt="">
                <span>微信</span>
            </p>
            <img src="../../../../../assets/img/复选框.png" alt="">
        </div>
        <!-- <img :src="listData.result" alt=""> -->
        <div class="footer">
            <button @click="onok">立即支付</button>
        </div>
        <van-overlay :show="show" @click="show = false">
            <div class="app">
                <div class="p">
                    <p>支付中...</p>
                </div>
            </div>
        </van-overlay>
    </div>
</template>
<script lang="ts" setup>
import axios from 'axios';
import { ref } from 'vue';
import { useRoute } from 'vue-router';
const show = ref(false)
const route = useRoute()
const listId = ref(route.query.id as string | undefined);
const listData = ref({} as listData)

interface listData {
    msg: string,
    result: string
}
const onok = () => {
    show.value = true
    axios.get('/api/pay', { params: { id: listId.value, price: '15', title: '微信支付', body: '图文问诊' } }).then(res => {
        listData.value = res.data
        setTimeout(() => {
            show.value = false
            window.location.href = res.data.result
        }, 3000)
    })
}
</script>